<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2020/9/16
  Time: 11:12
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="utf-8">
    <title>Sheraton酒店管理系统</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/public.css" media="all" />
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/layui_ext/dtree/dtree.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/layui_ext/dtree/font/dtreefont.css">
</head>
<body class="childrenBody">
<!-- 搜索条件开始 -->
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
    <legend>查询条件</legend>
</fieldset>
<form class="layui-form" method="post" id="searchFrm">

    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">流水单号:</label>
            <div class="layui-input-inline" style="padding: 5px">
                <input type="text" name="checkId" autocomplete="off" class="layui-input layui-input-inline"
                       placeholder="请输入流水单号" style="height: 30px;border-radius: 10px">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">客户昵称:</label>
            <div class="layui-input-inline" style="padding: 5px">
                <input type="text" name="loginName" autocomplete="off" class="layui-input layui-input-inline"
                       placeholder="请输入客户昵称" style="height: 30px;border-radius: 10px">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">房号:</label>
            <div class="layui-input-inline" style="padding: 5px">
                <input type="text" name="hId" autocomplete="off" class="layui-input layui-input-inline"
                       placeholder="请输入房号" style="height: 30px;border-radius: 10px">
            </div>
        </div>
    </div>

    <div class="layui-form-item" style="text-align: center">
        <div class="layui-input-black" >
            <button type="button"
                    class="layui-btn layui-btn-normal layui-icon layui-icon-search layui-btn-radius layui-btn-sm"
                    lay-submit  lay-filter="doSearch" style="margin-top: 4px">查询
            </button>
            <button type="reset"
                    class="layui-btn layui-btn-warm layui-icon layui-icon-refresh layui-btn-radius layui-btn-sm"
                    style="margin-top: 4px">重置
            </button>
        </div>
    </div>

</form>
<!-- 搜索条件结束 -->
<table id="rentTable" lay-filter="rentTable"></table>


<script id="barCar" type="text/html">

    <%-- 汽车未归还显示编辑和删除按钮， 如果归还就不显示 --%>
    <%--{{#  if(d.rentflag == 0){ }}--%>
    <%--<a class="layui-btn layui-btn-xs layui-btn-radius" lay-event="edit">编辑</a>--%>
    <%--<a class="layui-btn layui-btn-danger layui-btn-xs layui-btn-radius" lay-event="del">删除</a>--%>
    <%--{{# }else{ }}--%>
    <a class="layui-btn layui-btn-green layui-btn-xs layui-btn-radius" lay-event="exportRent">导出出租单</a>
    <%--{{# } }}--%>

</script>





<script type="text/javascript" src="${pageContext.request.contextPath}/static/layui/layui.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/js/index.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/js/cache.js"></script>
<script>
    var tab;
    layui.use(
        ['table', 'layer', 'form', 'jquery','upload','laydate'], function () {
            var table = layui.table;
            var form = layui.form;
            var $ = layui.jquery;
            var layer = layui.layer;
            var upload=layui.upload;
            var laydate = layui.laydate;

            laydate.render({
                elem: '#startTime' //指定元素
                , type: "datetime"
            });

            laydate.render({
                elem: '#endTime' //指定元素
                , type: "datetime"
            });

            tab = table.render({
                elem: '#rentTable',
                url: "${pageContext.request.contextPath}/check/checkShow",
                cellMinWidth: 30,
                page: {limit: 5, limits: [5, 10, 15, 20]},
                // toolbar: '#toolbarCar',//开启头部工具栏，并为其绑定左侧模板
                cols: [[
                    {field: 'checkId', width: 200, title: '流水单号', sort: true}
                    ,{field: 'starttime', width: 150, title: '预订时间', sort: true}
                    , {field: 'endtime', width: 150, title: '还房时间', sort: true}
                    , {field: 'problem', width: 100, title: '房屋设施损坏'}
                    ,{field: 'hId', width: 80, title: '房号', sort: true}
                    ,{field: 'loginName', width: 80, title: '客户昵称', sort: true}
                    ,{field: 'phone', width: 100, title: '联系方式', sort: true}
                    ,{field: 'hotelType', width: 120, title: '房屋类型', sort: true}
                    , {fixed: 'right', title: '操作', toolbar: '#barCar'}
                ]]
            })

            form.on('submit(doSearch)', function (data) {
                //ajax数据
                tab.reload({
                    where: data.field
                })
                //不跳转页面
                return false;
            })

            table.on('tool(rentTable)', function (obj) {
                var data = obj.data
              if(obj.event=="exportRent"){
                    //导出
                    exportRent(data)
                }
            })



            function exportRent(data){
                location.href="${pageContext.request.contextPath}/check/exportInfo?checkId="+data.checkId
            }


        })

</script>
</body>
</html>

